package SortAlgorithm;

import java.util.Arrays;

public class InsertSort2 {
    public static void main(String[] args) {
        int[] test=new int[]{83, 30, 26, 100, 75, 48, 8 ,71 ,90, 98};
        System.out.println(Arrays.toString(test));
        insertSort(test);
        System.out.println(Arrays.toString(test));
    }
    public static void insertSort(int[] array){
        for(int i=1;i<array.length;i++){
            int target=array[i];
            int j=i-1;
            while(j>-1&&target>array[j]){
                array[j+1]=array[j];
                j--;
            }
            array[j+1]=target;
        }
    }
}
